#include <iostream>
#include <list>
#include <string>

using namespace std;

class Student{
public:
    Student(string str,int ch,int mt,int en)
        :_name(str)
         ,_Chinese(ch)
         ,_math(mt)
         ,_english(en)
         ,_sum(ch + mt + en)
    {

    }

public:
    string _name;
    int _Chinese;
    int _math;
    int _english;
    int _sum;
};

bool operator>(const Student &st1,const Student &st2){

    if(st1._sum > st2._sum){
        return true;
    }
    else if(st1._sum == st2._sum)
    {
        if(st1._Chinese > st2._Chinese){
            return true;
            /* return st1._Chinese > st2._Chinese; */
        }
        else{
            return false;
        }
    }
    else
    {
        return false;
    }
}

bool mycompare(const Student &s1,const Student &s2){
    if(s1._sum > s2._sum){
        /* return s1._sum > s2._sum; */
        return true;
    }
    else if(s1._sum == s2._sum){
        if(s1._Chinese > s2._Chinese){
            return true;
        }
        else{
            return false;
        }
    }
    else{
            return false;
        }
}



/* template<typename Container> */
/* void display(Container & con) */
/* { */
/*     for(auto &ele:con){ */
/*         cout << ele << " "; */
/*     } */
/*     cout << endl; */
/*     cout << endl; */
/* } */

void test(){
    list<Student> lst;

    Student stu1("zs",86,95,67);
    Student stu2("ls",66,52,79);
    Student stu3("we",73,68,56);
    Student stu4("mz",58,55,56);
    Student stu5("zl",82,76,64);
    Student stu6("lq",73,57,83);

    lst.push_back(stu1);
    lst.push_back(stu2);
    lst.push_back(stu3);
    lst.push_back(stu4);
    lst.push_back(stu5);
    lst.push_back(stu6);

    /* lst.sort(greater<Student>()); */
    lst.sort(mycompare);

    for(auto &ele:lst){
        cout << "姓名：" << ele._name << " ";
        cout << "语文：" << ele._Chinese << " ";
        cout << "数学：" << ele._math << " ";
        cout << "英语：" << ele._english << " ";
        cout << "总分：" << ele._sum<< endl;
    }
}

int main()
{
    test();
    return 0;
}

